<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of GenericWS
 *
 * @author josem
 */
class GenericWS {
    protected $soapClient;
    
    public function __construct($wsdl) {
       if(is_null($this->soapClient)){
           //$this->soapClient = new soapclient($wsdl, true);
           $this->soapClient = new nusoap_client($wsdl, true);
            if ($error = $this->soapClient->getError()) {
                throw new Exception('No se pudo realizar la conexión [" . $sError . "]', "WS-00");            
            }       
       }       
   }
    
    protected function resultado($respuesta){
       if ($this->soapClient->fault) { // Si    
                throw new Exception('No se pudo completar la operaci&oacute;n', "WS-01");            
        } else { 
            $sError = $this->soapClient->getError();                
            if ($sError) {        
                    throw new Exception('No se pudo realizar la operación [" . $sError . "]', "WS-02");            
            } 
        }
        return $respuesta;
   }
}

?>
